package io.github.yuazer.zpokespring;

import io.github.yuazer.zaxlib.Utils.YamlUtils;
import io.github.yuazer.zpokespring.Commands.cmds;
import io.github.yuazer.zpokespring.Listener.SpringListener;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;

public class Main extends JavaPlugin {
    private static Main instance;

    public static Main getInstance() {
        return instance;
    }

    @Override
    public void onEnable() {
        // YuaZer 字符画
        System.out.println("__   __          ______          \n" +
                "\\ \\ / /         |___  /          \n" +
                " \\ V _   _  __ _   / /  ___ _ __ \n" +
                "  \\ | | | |/ _` | / /  / _ | '__|\n" +
                "  | | |_| | (_| ./ /__|  __| |   \n" +
                "  \\_/\\__,_|\\__,_\\_____/\\___|_| ");

        instance = this;
        YamlUtils.setINSTANCE(this);
        this.getLogger().info("§aZPokeSpring[1.16.5]");
        this.getLogger().info("§3状态-    §a已加载");
        this.getLogger().info("§3作者-    §bZ菌:QQ[1109132]");
        this.getLogger().info("§3版本-    §6" + this.getDescription().getVersion());
        saveDefaultConfig();
        Bukkit.getPluginCommand("zpokespring").setExecutor(new cmds());
        new BukkitRunnable() {
            @Override
            public void run() {
                SpringListener sl = new SpringListener();
                sl.getExp();
            }
        }.runTaskTimerAsynchronously(this, 0L, 20L * 60);
    }

    @Override
    public void onDisable() {
        this.getLogger().info("§a[ZPokeSpring] §e插件已卸载");
    }
}
